﻿using SchoolPointe.RelatedContent.Enums;
using System.Collections.Generic;
using Orchard.ContentManagement;
using System.Linq;

namespace SchoolPointe.RelatedContent.ViewModels
{
    public class RelatedContentRelationshipViewModel
    {
        public RelatedContentRelationshipViewModel() { }

        public RelatedContentRelationshipViewModel(IList<IContent> relatedItems) {
            this.RelatedItems = relatedItems;
            this.RelatedContentIds = string.Join(",", relatedItems.Select(ri => ri.Id.ToString()));
        }

        public string Identifier { get; set; }
        public string RelatedContentIds { get; set; }
        public string Name { get; set; }
        public RelationType RelationType { get; set; }
        public bool IsRequired { get; set; }
        public string EditorTemplate { get; set; }
        public string InverseOf { get; set; }

        public IEnumerable<IContent> RelatedItems { get; private set; }
    }
}